package com.cxcs.cxcsoj.judge.codesandbox;

import com.cxcs.cxcsoj.judge.codesandbox.model.ExecuteCodeRequest;
import com.cxcs.cxcsoj.judge.codesandbox.model.ExecuteCodeResponse;
import com.github.mustachejava.Code;
import lombok.extern.slf4j.Slf4j;

/**
 * 代码沙箱-代理模式类
 *
 * @Author: CxCS
 * @Version: 1.0
 * @Date: 2024-08
 */
@Slf4j
public class CodeSandBoxProxy implements CodeSandBox {
    private final CodeSandBox codeSandBox;
    public CodeSandBoxProxy(CodeSandBox codeSandBox) {
        this.codeSandBox = codeSandBox;
    }
    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest, String url) {
        log.info("代码沙箱请求信息：" + executeCodeRequest.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandBox.executeCode(executeCodeRequest, url);
        log.info("代码沙箱响应信息：" + executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
